package com.lufei.dh.view.Mult.Adapter.Lam;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lufei.dh.R;
import com.lufei.dh.view.Mult.Bean.Song;

import me.drakeet.multitype.ItemViewBinder;

/**
 * 版权：易金卡沃 版权所有
 * <p>
 * 作者：lufei
 * <p>
 * 创建日期：2018/6/29
 * <p>
 * 描述：
 * <p>
 * 修订历史：
 */
public class SongViewBinder2 extends ItemViewBinder<Song, SongViewBinder2.ViewHolder> {
    private Context context;

    public SongViewBinder2(Context context) {
        this.context = context;
    }

    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater layoutInflater, @NonNull ViewGroup viewGroup) {
        View root = layoutInflater.inflate(R.layout.item_song, viewGroup, false);
        return new ViewHolder(root);
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder viewHolder, @NonNull final Song song) {
        viewHolder.title.setText(song.getTitle());
        viewHolder.time.setText(song.getDate());
        Glide.with(context).load(song.getThumbnail_pic_s()).into(viewHolder.imageView1);
        Glide.with(context).load(song.getThumbnail_pic_s02()).into(viewHolder.imageView2);
        Glide.with(context).load(song.getThumbnail_pic_s03()).into(viewHolder.imageView3);
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
        private TextView title;

        private TextView time;
        private ImageView imageView1;
        private ImageView imageView2;
        private ImageView imageView3;

        public ViewHolder(View itemView) {
            super(itemView);
            title = itemView.findViewById(R.id.title);
            time = itemView.findViewById(R.id.time);
            imageView1 = itemView.findViewById(R.id.image1);
            imageView2 = itemView.findViewById(R.id.image2);
            imageView3 = itemView.findViewById(R.id.image3);
        }
    }
}
